<fieldset>
    <legend>条件搜索</legend>
    <form class="layui-form layui-form-pane form-search" action="{:request()->url()}" onsubmit="return false" method="get" autocomplete="off">
        <div class="layui-form-item layui-inline">
            <label class="layui-form-label">课程名称</label>
            <div class="layui-input-inline">
                <input name="name" value="{$Think.get.name|default=''}" placeholder="请输入课程名称" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item layui-inline">
            <label class="layui-form-label">课程标题</label>
            <div class="layui-input-inline">
                <input name="title" value="{$Think.get.title|default=''}" placeholder="请输入课程标题" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item layui-inline">
            <label class="layui-form-label">分类</label>
            <div class="layui-input-inline">
                <input name="cate_id" value="{$Think.get.cate_id|default=''}" placeholder="请选择分类"  class="layui-input selectpage" data-source="/admin/course_cate/selectpage" data-field="name">
            </div>
        </div>
        <div class="layui-form-item layui-inline">
            <label class="layui-form-label">状态</label>
            <div class="layui-input-inline">
                <select class="layui-select" name="status" lay-search>
                    <option value="">-- 全部 --</option>
                    {foreach [0=>'禁用',1=>'启用'] as $k=>$v}
                    <option value="{$k}">{$v}</option>
                    {/foreach}
                </select>
            </div>
        </div>
        <div class="layui-form-item layui-inline">
            <button class="layui-btn layui-btn-primary"><i class="layui-icon">&#xe615;</i> 搜 索</button>
            <button type="button" class="layui-btn layui-btn-primary" id="import"><i class="layui-icon"></i>导入课程EXCEL</button>&nbsp;
            <button type="button" data-import-list class="layui-btn layui-btn-primary"><i class="layui-icon layui-icon-export"></i>下载导入模板</button>
            <button type="button" data-export-list class="layui-btn layui-btn-primary"><i class="layui-icon layui-icon-export"></i>导出</button>
        </div>
    </form>
    <script>
        window.form.render();
        $('[data-import-list]').on('click', function () {
            window.location.href = '{:url("import_template",false,false)}?' + $(this).parents('form').serialize()
        });
        $('[data-export-list]').on('click', function () {
            window.location.href = '{:url("@")}?s={:url("export_course",false,false)}&' + $(this).parents('form').serialize()
        });
    </script>

    <script>
        layui.use('upload', function () {
            var upload = layui.upload;

            upload.render({
                elem: '#import'
                , url: '{:url("import",false,false)}'
                , accept: 'file'
                , size: 60000 //限制文件大小，单位 KB
                , done: function (res) {
                    if(res.code==1){
                        layer.alert('导入成功，请刷新页面！')
                    }else if(res.code==0){
                        layer.alert('导入失败，格式有误！')
                    }

                }
            });
        });

    </script>
</fieldset>